#ifndef STRUCTURES_H
#define STRUCTURES_H
#include <vector>
#include <Windows.h>
#include "Image.h"
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned long








struct RectBuff{
  long Y,X;
 long StartX ;
 long StartY ;
 long oX;
 long oY;
 long EndX;
 long EndY;
 u8 Started;
};





struct sctype{
u8 xStart;
u8 xEnd;
u8 yStart;
u8 yEnd;
};

class Scroller{
public:
     Scroller();
	~Scroller();
u8 Room;
u8 Number;
sctype Scrolls[0xFF];
};

//EXT scroll As Scroller
class cScroll{
public:

int      CreateScroll(sctype *thisscroll);
private:

	HWND xStart;
	HWND hWidth;
	HWND yStart;
	HWND hHeight;
	RECT curRect;
};






struct MousePointer{
u8 sX;
u8 sY;
u8 eX;
u8 eY;
u8 cX;
u8 cY;
u8 nX;
u8 nY;
u8 uX;
u8 uY;
u8 Width;
u8 Height;

};




struct CompHeader{
   u8 check_ten;       //Check byte should be 0x10 for lz
   u8  l3;        //length = l3*0x10000 + l2*0x100 + l1
   u8  l2;
   u8  l1;
};



struct sTileMacros{
	   u8 Clipdata;
	   u16 ForegroundTile;
	   u16 BacklayerTile;
};




struct tBlock{
    u16 Tile;
	u16  HFlip;
	u16  VFlip;
	u16  Pal;
};


class lz77
{
public:

	lz77(void);
	~lz77(void);
     
	u8 UnCmpData[3][2048*4];
	u8 UnCmpPal[5][32*4];
	u8 smallpal[2];
	u8 filedata[170000];
	int filedatapos;


	int length;
	//u16 unCmpSize;

	void BIOS_LZ77UnCompWram();

	void BIOS_LZ77CompWram(u8 data[],int Size, int compression); //


	u32 CPUReadMemory(int source);
	u8 CPUReadByte(int source);
	void CPUWriteByte(unsigned long a, unsigned char b);
	void CPUWriteMemory(int adress, u32 data);
    
	u32 source;
	


	u8 cFile[170000];
	
};








struct sSpritev{
	u8 RAM[0x10000];
};



struct GFXData{
    u32  RomPointer;
	u32  MemDst;
};

struct PalData{
    u32 RomPointer;
	u32 MemDst;
	u32 Size;
};








struct RECORD{
	u8	*data;
	u32	width;
	u32	height;
};

class wndCPal{
HWND me;
long epal[256];
int  refreshWnd(HWND hwnd);
int  hascontrol;
int  GiveControl();


};





#endif